package com.lagou.rpc.codec;

import java.io.IOException;

/**
 * @ClassName: Serializer
 * @Description: 序列化接口
 * @Author: wuguizhen
 * @Date: 2020/4/19 20:39
 * @Version: v1.0 文件初始创建
 */
public interface Serializer {

    /**
     * @Description: java对象转换为二进制
     * @param object
     * @Date: 2020/4/19 20:29
     * @Author: wuguizhen
     * @Return byte[]
     * @Throws
     */
    byte[] serialize(Object object) throws IOException;



    /**
     * @Description: 二进制转换成java对象
     * @param clazz
     * @param bytes
     * @Date: 2020/4/19 20:29
     * @Author: wuguizhen
     * @Return T
     * @Throws
     */
    <T> T deserialize(Class<T> clazz, byte[] bytes) throws IOException;
}
